#ifndef COMMUNICATOR_H_
#define COMMUNICATOR_H_

// 网络通信类
class Communicator
{
    
public:
	Communicator();
	~Communicator();
    
	int Connect(const char *address, unsigned short port);
	int SendData(const char *buffer, int bufferSize);
    
    // 接收指定长度
    int RecvLength(char*buffer, int bufferLength, int needRecvLength);
    
    int RecvData(char* buffer, int bufferLength, int& dataLength);
    int RecvAliveData(char* buffer, int bufferLength, int& dataLength);
	int DisConnect();
    
    int RecvHttpData(char *buffer, int bufferSize, int *recvSize);
    
private:
    //int Recv();
	int _sk; // socket handle
};



#endif /*COMMUNICATOR_H_*/
